layui.define(['layer', 'element'], function(exports){
    var $ = layui.jquery
    ,layer = layui.layer
    ,element = layui.element;
    
    var index = {
        init: function() {
            // 监听侧边伸缩
            $('.layadmin-flexible').click(function(){
                var side = $('.layui-side')
                ,body = $('.layui-body')
                ,sideWidth = side.width();
                
                if(sideWidth === 220) {
                    side.animate({width: '60px'}, 200);
                    body.animate({left: '60px'}, 200);
                    $('.layui-logo').animate({width: '60px'}, 200);
                    $('.layui-side .layui-nav-item > a cite').hide();
                } else {
                    side.animate({width: '220px'}, 200);
                    body.animate({left: '220px'}, 200);
                    $('.layui-logo').animate({width: '220px'}, 200);
                    $('.layui-side .layui-nav-item > a cite').show();
                }
            });
        }
    };
    
    exports('index', index);
}); 